//返回认证列表状态字段
function returnNum(data) {
    //check_state
    //1.已预约
    //2.正在考试
    //3.通过
    //4.未通过
    //5.未考试
    //0.已驳回
    if (data.ispay == 0) {
        if (data.status == 2) {
            //已驳回;
            return 2;
        } else {
            //未支付
            return 0;
        }
    } else if (data.ispay == 1 && (data.status == 0 || data.status == null)) {
        //正在审核报名
        return 1;
    } else if (data.ispay == 1 && data.status == 2) {
        //已驳回;
        return 2;
    } else if (data.ispay == 1 && data.status == 1 && (data.check_state == null && data.check_state != '0')) {
        //申请考试
        return 3;
    } else if (data.check_state == 4 || data.check_state == 5) {
        if (data.id == 59 || data.id == 60 || data.id == 61) {//学霸赛认证
            //未通过,不再继续申请
            return 10;
        } else {
            //申请考试
            return 3;
        }
    } else if (data.ispay == 1 && data.status == 1 && data.check_state == 1) {
        //考试正在审核
        return 4;
    } else if (data.ispay == 1 && data.status == 1 && data.check_state == 0) {
        //申请考试已驳回
        return 5;
        //1.技能未阅,理论未阅
        //2.理论阅,技能未阅
        //3.理论未阅，技能已阅
        //4.理论未阅，实操已阅
        //5.理论阅，实操未阅
        //6.理论未阅，实操未阅
//	} else if (data.ispay == 1 && data.status == 1 && data.check_state == 2 && ((data.exam_ll.hasOwnProperty('loding') == false && data.exam_jn.hasOwnProperty('loding') == false ) 
//	|| (data.exam_ll.hasOwnProperty('loding') == true && data.exam_jn.hasOwnProperty('loding') == false ) 
//	|| (data.exam_ll.hasOwnProperty('loding') == false && data.exam_jn.hasOwnProperty('loding') == true ) 
//	|| (data.exam_ll.hasOwnProperty('loding') == false && data.exam_sc.status == 'loding') 
//	|| (data.exam_ll.hasOwnProperty('loding') == true && data.exam_jn == "" && data.exam_sc.hasOwnProperty('status') == true && data.exam_sc.status != 'loding') 
//	|| (data.exam_ll.hasOwnProperty('loding') == false && data.exam_sc.hasOwnProperty('status') == true && data.exam_sc.status != 'loding'))) {
    } else if (data.zhuangtai == 6) {
        if (data.id == 59 || data.id == 60 || data.id == 61) {//学霸赛认证
            //开始考试
            if (data.exam_ll.hasOwnProperty("chengji")) {
                if (data.exam_ll.chengji.is_pingjuan == 1) {//阅卷
                    if (data.exam_ll.chengji.chengji > data.exam_ll.efen) {//及格
                        return 8;
                    } else {//不及格
                        //未通过,不再继续申请
                        return 10;
                    }
                } else {//未阅卷
                    if (((data.exam_ll.loding == '2') && (data.exam_jn == "" || data.exam_jn.exam_id == 0) && (data.exam_sc == ""))) {//正在阅卷
                        return 7;
                    } else {
                        return 6;
                    }
                }
            } else {//没有成绩字段
                if (((data.exam_ll.loding == '2') && (data.exam_jn == "" || data.exam_jn.exam_id == 0) && (data.exam_sc == ""))) {
                    return 7;
                } else {
                    return 6;
                }
            }
        } else {
            return 6;
        }
        //理论阅卷中，并且技能阅卷中
        //理论阅卷中，并且实操阅卷中
        //理论阅卷中，技能已阅
        //理论阅卷中，实操已阅
        //理论已阅，并且技能阅卷中
        //理论已阅，并且实操阅卷中
    } else if (((data.exam_ll.loding == '2') && (data.exam_jn.loding == '2')) || ((data.exam_ll.loding == '2') && (data.exam_sc.status == 'loading'))
    //	  || ((data.exam_ll.loding == '2') && (data.exam_jn.status == 'pass'))
    //	  || ((data.exam_ll.loding == '2') && (data.exam_sc.status == 'pass'))
    //	  || ((data.exam_ll.status == 'pass') && (data.exam_jn.loding == '2'))
    //	  || ((data.exam_ll.status == 'pass') && (data.exam_sc.status == 'loading'))
    ) {

        //正在阅卷
        return 7;
    } else if (data.check_state == 3) {
        //		if (data.zhshu == '' || data.zhshu == '[]') {
        // 认证成功
        return 8;

        //		} else {
        //			// 查看证书
        //			return 9;
        //
        //		}

    } else if (data.exam_ll.chengji == undefined || data.exam_jn.chengji == undefined || data.exam_ll.chengji.is_pingjuan == null || data.exam_jn.chengji.is_pingjuan == null) {
        //如果有阅卷的则显示开始考试(在弹出框中判断那种题型已阅,哪种没阅)
        return 6;
    } else {
        return 34;
    }
}

//html代码拼接
function htmlStringWithName(data, i) {
    var strhtml = "";
    var imgStr = '';
    var test_schedule = '';
    var typeName = '';
    var btnStr = '';
    var timeStr = '';
    var promptStr = '';
    //			for (var i = 0; i < len; i++) {
    var list = data;
    var start_timeStr = getLocalTime(parseInt(list.start_time));
    var start_time = parseInt(list.start_time);
    var nowtime = (Date.parse(new Date())) / 1000;

    test_schedule = list.kaohejd.replace(/[&\|\\\*^%$#@\-]/g, "");

    var num = returnNum(list);
    // var num = getCertificationType(list);
    if (list.id === 7)
        console.log("快运操作员" + num);
    if (list.img == '') {
        imgStr = '../../image/list-default.png';
    } else {
        imgStr = list.img;

    }
    if (list.ispay === 0) {
        //todo 待支付
        promptStr = '<div class="aui-list-item-text " id="three" dataid="' + i + '" style="margin-top: 0.1rem">' + '<span class="toast_div">待支付<span class="schedulecount left_5"> <em id="schedule">¥</em> <span class="schedulecount">' + numNull(list.apply_money) + '</span> </span>' + '</div>';
        btnStr = '<div class="aui-btn aui-btn-score-highlighted left" onclick="openPay(' + i + ',1)" id="btn' + list.id + '"style="margin-right: 0.5rem" >立即支付' + '</div>' + '<div class="aui-btn aui-btn-score-disabled "   style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >申请考试' + '</div>';
    }else if(list.status == 0 || list.status == null){
        promptStr = '<div class="aui-list-item-text " id="three" dataid="' + i + '" style="margin-top: 0.1rem">' + '<span class="toast_div">待审核 </span>' + '</div>';
        btnStr = '<div class="aui-btn aui-btn-score-disabled " >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-disabled "   style="margin-left: 0.5rem ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >申请考试' + '</div>';
    }else {
        promptStr=examInfo(list,i);
        btnStr=examBtn(list,i);
    }
    /*switch (num) {
        case 0:
            typeName = '未支付';
            promptStr = '<div class="aui-list-item-text " id="three" dataid="' + i + '" style="margin-top: 0.1rem">' + '<span class="toast_div">待支付<span class="schedulecount left_5"> <em id="schedule">¥</em> <span class="schedulecount">' + numNull(list.apply_money) + '</span> </span>' + '</div>';
            btnStr = '<div class="aui-btn aui-btn-score-highlighted left" onclick="openPay(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >立即支付' + '</div>' + '<div class="aui-btn aui-btn-score-disabled "   style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >申请考试' + '</div>';
            break;
        case 1:
            typeName = '报名正在审核';
            promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">请您耐心等待我们工作人员审核,审核通过后即可学习，谢谢合作！' + '</span>' + '</div>';
            btnStr = '<div class="aui-btn aui-btn-score-disabled left"  id="btn' + list.id + '"style="margin-right: 0.5rem" >正在审核' + '</div>' + '<div class="aui-btn aui-btn-score-disabled "    style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >申请考试' + '</div>';
            break;
        case 2:
            typeName = '报名已驳回';
            promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">报名申请已驳回:' + list.apply_reject + '</span>' + '</div>';
            btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="AgainSignUp(' + i + ')" style="margin-right: 0.5rem" >重新报名' + '</div>' + '<div class="aui-btn aui-btn-score-disabled "    style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >申请考试' + '</div>';
            break;
        case 3:
            if (data.id == 59 || data.id == 60 || data.id == 61) {//学霸赛
                if (nowtime >= 1514563200) {//超过12月29日
                    typeName = '申请考试';

                    promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">学霸赛认证岗位预约考试时间已过 ' + '</span>' + '</div>';

                    btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal "   onclick="MoccChoose(' + i + ')" style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >申请考试' + '</div>';
                } else {
                    typeName = '申请考试';
                    if (list.check_state == 4) {
                        promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">考试未通过，请重新考试!' + '</span>' + '</div>';
                    } else {
                        promptStr = '';
                    }
                    btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal "   onclick="MoccChoose(' + i + ')" style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="yuyueShow(' + list.id + ',' + i + ')">申请考试' + '</div>';
                }
            } else {
                typeName = '申请考试';
                if (list.check_state == 4) {
                    promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">考试未通过，请重新考试!' + '</span>' + '</div>';
                } else {
                    promptStr = '';
                }
                btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal "   onclick="MoccChoose(' + i + ')" style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="yuyueShow(' + list.id + ',' + i + ')">申请考试' + '</div>';

            }
            break;
        case 4:
            typeName = '正在审核';
            promptStr = '';
            btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem"  >正在审核' + '</div>';
            break;
        case 5:
            if (data.id == 59 || data.id == 60 || data.id == 61) {//学霸赛
                if (nowtime >= 1514563200) {//超过12月29日
                    typeName = '申请考试已驳回';
                    promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">学霸赛认证岗位预约考试时间已过' + '</span>' + '</div>';
                    btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >申请考试' + '</div>';
                } else {
                    typeName = '申请考试已驳回';
                    promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">申请考试已驳回:' + list.reject + '</span>' + '</div>';
                    btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="yuyueShow(' + list.id + ',' + i + ')">申请考试' + '</div>';
                }
            } else {
                typeName = '申请考试已驳回';
                promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">申请考试已驳回:' + list.reject + '</span>' + '</div>';
                btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="yuyueShow(' + list.id + ',' + i + ')">申请考试' + '</div>';

            }
            break;
        case 6:
            typeName = '开始考试';
            if (nowtime > start_time + 57600) {
                if (data.id == 59 || data.id == 60 || data.id == 61) {
                    if (nowtime >= 1514563200) {//超过12月30日
                        promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">学霸赛认证岗位预约考试时间已过' + '</span>' + '</div>';
                        btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >申请考试' + '</div>';
                    } else {
                        promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">考试时间已过期,请重新申请' + '</span>' + '</div>';
                        btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="yuyueShow(' + list.id + ',' + i + ')" >申请考试' + '</div>';
                    }
                } else {
                    promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">考试时间已过期,请重新申请' + '</span>' + '</div>';
                    btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="yuyueShow(' + list.id + ',' + i + ')" >申请考试' + '</div>';
                }
            } else {
                promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">考试时间:请于' + start_timeStr + '  09:00-16:00时进行考试.</span>' + '</div>';
                btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="StartTest(' + i + ',' + list.start_time + ',' + list.id + ')" >开始考试' + '</div>';
            }
            break;
        case 7:
            typeName = '正在阅卷';
            promptStr = '';
            btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >正在阅卷' + '</div>';
            break;
        case 8:
            typeName = '认证完成';
            promptStr = '';
            btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal "   onclick="MoccChoose(' + i + ')" style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >认证完成' + '</div>';
            break;
        case 9:
            typeName = '查看证书';
            promptStr = '';
            btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal "   onclick="MoccChoose(' + i + ')" style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" onclick="openMyAttestation(' + i + ')"   style="margin-left: 0.5rem" >查看证书' + '</div>';
            break;
        case 10:
            typeName = '未通过';
            promptStr = '';
            btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')"  id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal "   onclick="MoccChoose(' + i + ')" style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left"    style="margin-left: 0.5rem" >认证未通过' + '</div>';
            break;

        default:
            if (data.id == 59 || data.id == 60 || data.id == 61) {
                if (nowtime >= 1514563200) {//超过12月30日
                    promptStr = '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px">' + '<span class=" span_place" style="color: #f64e4e">学霸赛认证岗位预约考试时间已过' + '</span>' + '</div>';
                    btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >申请考试' + '</div>';
                } else {
                    promptStr = '';
                    btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal "   onclick="MoccChoose(' + i + ')" style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="yuyueShow(' + list.id + ',' + i + ')">申请考试' + '</div>';
                }
            } else {
                promptStr = '';
                btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + list.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal "   onclick="MoccChoose(' + i + ')" style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="yuyueShow(' + list.id + ',' + i + ')">申请考试' + '</div>';
            }

    }*/
    return '<li class="aui-list-item list_month" >' + '<div class="aui-media-list-item-inner ">' + '<div class="aui-list-item-media" id="one" dataid="' + i + '" >' + '<img src="' + imgStr + '"   class="course-img"  onerror="Imgnofind()">' + '</div>' + '<div class="aui-list-item-inner margin-t-4">' + '<div class="aui-list-item-text " id="two" dataid="' + i + '">' + '	<div class="aui-list-item-title"  style="margin-top: 0.4rem">' + list.quarter + '</div>' + '</div>' + '<div class="aui-list-item-text " style="margin-top: 0.4rem">' + '<span class="span_place">学习进度:<span class="schedulecount left_5"><em id="schedule">' + numNull(list.learn_plan) + '</em><span class="schedulesymbol">%</span></span></span>' + '</div>' + '<div class="aui-list-item-text " style="margin-top: 0.3rem">' + '<span class="span_place">考核进度:<span class="schedulecount left_5"><em id="schedule">' + test_schedule + '</em><span class="schedulesymbol">%</span></span></span>' + '</div>' + promptStr + '</div>' + '</div>' + '<div class="aui-list-item-inner " style="width: 100%;border-top: 1px solid #f0f0f0;display: table;padding-right: 0.5rem">' + '<div class="aui-info-item " >' + btnStr + '</div>' + '</div>' + '</li>' + '<div class="interval"></div>';
}
function examBtn(data,i) {
    if(data.check_state==3){
        //todo 考试通过
        return '<div class="aui-btn aui-btn-score-disabled " >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-disabled "   style="margin-left: 0.5rem ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" >考试通过' + '</div>' ;
    }else if(data.exam_ll_status===11 || data.exam_jn_status===11 || data.exam_sc_status===11 || data.exam_xt_status===11){
        //todo 超过补考次数
        return btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + data.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-highlighted left" onclick="openPay(' + i + ',2)" style="margin-left: 0.5rem" >补缴' + '</div>';
    }else if(data.exam_ll_status===6 || data.exam_jn_status ===6 || data.exam_sc_status===6 ||data.exam_xt_status===6) {
        //todo 有一门处于考试状态
        return btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + data.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="StartTest(' + i + ',' + data.start_time + ',' + data.id + ')" >开始考试' + '</div>';
    }else if((data.exam_ll_status===2 || data.exam_jn_status ===2 || data.exam_sc_status===2 ||data.exam_xt_status===2) &&
        (checkState(data.exam_ll_status,[2,8,9]) && checkState(data.exam_jn_status,[2,8,9]) ||
        checkState(data.exam_ll_status,[2,8,9]) && checkState(data.exam_sc_status,[2,8,9]) ||
        checkState(data.exam_ll_status,[2,8,9]) && checkState(data.exam_xt_status,[2,8,9]))){
        //todo 一门处于审核状态，另一门处于审核，批阅，考试通过状态
        if(data.exam_ll_time_update===1 || data.exam_jn_time_update===1 || data.exam_sc_time_update===1 || data.exam_xt_time_update===1){
            return '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + data.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal "   onclick="MoccChoose(' + i + ')" style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="yuyueShow(' + data.id + ',' + i + ')">申请考试' + '</div>';
        }else{
            return btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + data.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >审核中' + '</div>';
        }
    }else if((data.exam_ll_status===8 || data.exam_jn_status ===8 || data.exam_sc_status===8||data.exam_xt_status===8) &&
        ( checkState(data.exam_ll_status,[8,9]) && checkState(data.exam_jn_status,[8,9]) ||
        checkState(data.exam_ll_status,[8,9]) && checkState(data.exam_sc_status,[8,9]) ||
        checkState(data.exam_ll_status,[8,9]) && checkState(data.exam_xt_status,[8,9]))
       ){
        //todo 一门处于批阅状态，另一门处于批阅，考试通过状态
        return btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + data.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >待批阅' + '</div>';
    }else if((data.exam_ll_status===5 || data.exam_jn_status ===5 || data.exam_sc_status===5 ||data.exam_xt_status===5) &&
        ( checkState(data.exam_ll_status,[2,5,8,9]) && checkState(data.exam_jn_status,[2,5,8,9]) ||
            checkState(data.exam_ll_status,[2,5,8,9]) && checkState(data.exam_sc_status,[2,5,8,9]) ||
            checkState(data.exam_ll_status,[2,5,8,9]) && checkState(data.exam_xt_status,[2,5,8,9]))
    ){
        //todo 一门处于待考核状态，另一门处于待考核考核，审核，批阅状态
        return btnStr = '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + data.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal " onclick="MoccChoose(' + i + ')" style="margin: 0 ;">模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-disabled left" style="margin-left: 0.5rem" >待考核' + '</div>';
    }else {
        return '<div class="aui-btn aui-btn-score-nomal left" onclick="StartStudy(' + i + ')" id="btn' + data.id + '"style="margin-right: 0.5rem" >开始学习' + '</div>' + '<div class="aui-btn aui-btn-score-nomal "   onclick="MoccChoose(' + i + ')" style="margin: 0 ;"  >模拟考试' + '</div>' + '<div class="aui-btn aui-btn-score-nomal left" style="margin-left: 0.5rem" onclick="yuyueShow(' + data.id + ',' + i + ')">申请考试' + '</div>';
    }
    function checkState(currentStatus,statusArray) {
        for (var j = 0; j < statusArray.length; j++) {
            if(statusArray[j]===currentStatus)
                return true;
        }
        return false;
    }
}
function examInfo(data,i) {
    var promptStr='';
    promptStr+=examItemInfo("理论考试",data.exam_ll_time,data.exam_ll_status,i);
    if(data.exam_type===1){
        promptStr+=examItemInfo("技能考试",data.exam_jn_time,data.exam_jn_status,i);
    }else if(data.exam_type===2){
        promptStr+=examItemInfo("实操考试",data.exam_sc_time,data.exam_sc_status,i);
    }else{
        promptStr+=examItemInfo("系统考试",data.exam_xt_time,data.exam_xt_status,i);
    }
    return promptStr;
}
function examItemInfo(beforeInfo, time, status, i) {
    var end='未预约';
    var color='#53bdfa';
    switch (status) {
        case 2:
            end='审核中';
            break;
        case 3:
            end='申请被驳回';
            color='#f64e4e';
            break;
        case 4://审核完成等待考试
        case 5:
        case 6://考试中
            end=getLocalTime(time)+' 09:00-16:00';
            //beforeInfo+='时间';
            break;
        case 7://未参加考试
            end='考试时间已过';
            color='#f64e4e';
            break;
        case 10://考试不达标
        case 12:
            end='未通过';
            color='#f64e4e';
            break;
        case 11:
            end='未通过(已超过补考次数)';
            color='#f64e4e';
            break;
        case 8:
            end='审阅中';
            break;
        case 9:
            end='通过';
            break;
    }
    return  '<div class="aui-list-item-text top_15" id="three" dataid="' + i + '" style="margin-top: 2px;display: block">' + beforeInfo+':<span class=" span_place" style="color:'+color+'">'+end+'</span>' + '</div>';
}
function changeTypeName(str) {
    if (str.status == 'nostart') {
        return ''
    } else if (str.status == "loading") {
        return "(" + "审阅中" + ")"
    } else if (str.status == "unpass") {
        return "(" + "未通过" + ")"
    } else if (str.status == "pass") {
        return "(" + "已通过" + ")"
    } else if (str.loding == "2") {
        return "(" + "审阅中" + ")"
    } else {
        return ''
    }
}

//打开我的证书详情页
function openMyAttestation(i) {
    var data = dataArr[parseInt(i)];
    var zhshuArr = data.zhshu;
    var id = data.id;
    api.openWin({useWKWebView:true,
        name: 'MyAttestationInfo',
        url: 'MyAttestationInfo.html',
        pageParam: {
            data: zhshuArr,
            id: id,
            sourceurl: window.location.pathname,
            sourcetitle: document.title
        }
    });

}

function returnMockStr(str) {
    if (str != '') {
        if (ReturnMockType(str) == 1) {
            return "(" + "已通过" + ")"
        } else {
            return ''
        }
    } else {
        return ''
    }
}

//模拟考试选择
function MoccChoose(i) {
    var winh = api.winHeight;
    var winw = api.winWidth;
    var data = dataArr[parseInt(i)];
    var lmStr = "理论模拟" + returnMockStr(data.exam_lm);
    var jmStr = "技能模拟" + returnMockStr(data.exam_jm);
    var scmStr = "实操模拟" + returnMockStr(data.exam_scm);
    var itmeArr = "";
    var column = "";
    var testType = "";
    if (data.exam_lm == "" && data.exam_jm == "" && data.exam_scm == "") {
        ShowToast('暂无模拟考试');
    } else if (data.exam_lm == "" && data.exam_jm != "" && data.exam_scm == "") {//技能
        itmeArr = [{
            text: jmStr,
            icon: 'widget://icon/moni-2.png'
        }];
        column = 1;
        testType = 1;
    } else if (data.exam_lm != "" && data.exam_jm == "" && data.exam_scm == "") {//理论
        itmeArr = [{
            text: lmStr,
            icon: 'widget://icon/moni_1.png'
        }];
        column = 1;
        testType = 2;
    } else if (data.exam_lm != '' && data.exam_jm != '' && data.exam_scm == '') {//理论加技能
        itmeArr = [{
            text: lmStr,
            icon: 'widget://icon/moni_1.png'
        }, {
            text: jmStr,
            icon: 'widget://icon/moni-2.png'
        }];
        column = 2;
        testType = 3;
    } else if (data.exam_lm == "" && data.exam_jm == "" && data.exam_scm != "") {//实操
        itmeArr = [{
            text: lmStr,
            icon: 'widget://icon/moni_1.png'
        }];
        column = 1;
        testType = 4;
    } else if (data.exam_lm != '' && data.exam_scm != '') {//理论加实操
        itmeArr = [{
            text: lmStr,
            icon: 'widget://icon/moni_1.png'
        }, {
            text: scmStr,
            icon: 'widget://icon/moni-2.png'
        }];
        column = 2;
        testType = 5;
    }
    var dialogBox = api.require('dialogBox');
    dialogBox.share({
        rect: {
            w: 0.7 * winw,
            h: 0.3 * winh
        },
        items: itmeArr,
        tapClose: true,
        styles: {
            bg: '#FFF',
            corner: 10,
            column: column,
            horizontalSpace: 15,
            verticalSpace: 30,
            itemText: {
                color: '#000',
                size: 15,
                marginT: 5
            },
            itemIcon: {
                size: 70
            }
        }
    }, function (ret) {
        if (ret.index == 0) {
            SendBehaviorTrajectoriesNotifi1('1', '我的认证列表页', '124', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
            if (testType == 2 || testType == 5 || testType == 3) {//第一个是理论模拟考试的情况下
                if (data.exam_lm != null && data.exam_lm != '' && data.exam_lm.enumber != '') {

                    var dataArr = {
                        id: data.id, //企业id
                        type: 3,
                        check_id: data.check_id,
                        exam: data.exam_lm.enumber,
                        cid: data.exam_lm.exam_id,
                        sourceurl: window.location.pathname,
                        sourcetitle: document.title,
                        quarter_name: data.quarter,
                    };
                    openMockExam(dataArr)

                } else {
                    ShowToast('理论考试暂无试卷');
                }
            } else if (testType == 1) {//技能
                if (data.exam_jm != null && data.exam_jm != '' && data.exam_jm.enumber != '') {
                    var dataArr = {
                        id: data.id, //企业id
                        type: 4,
                        check_id: data.check_id,
                        exam: data.exam_jm.enumber,
                        cid: data.exam_jm.exam_id,
                        sourceurl: window.location.pathname,
                        sourcetitle: document.title,
                        quarter_name: data.quarter,
                    };
                    openMockExam(dataArr)
                } else {
                    ShowToast('技能模拟暂无试卷');
                }
            } else if (testType == 4) {//实操
                if (data.exam_scm != null && data.exam_scm != '' && data.exam_scm.enumber != '') {
                    var dataArr = {
                        id: data.id, //企业id
                        type: 5,
                        check_id: data.check_id,
                        exam: data.exam_scm.enumber,
                        cid: data.exam_scm.exam_id,
                        sourceurl: window.location.pathname,
                        sourcetitle: document.title,
                        quarter_name: data.quarter,
                    };
                    openMockExam(dataArr)
                } else {
                    ShowToast('实操模拟暂无试卷');
                }
            }
        } else {
            SendBehaviorTrajectoriesNotifi1('1', '我的认证列表页', '124', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
            if (testType == 3) {//技能
                if (data.exam_jm != null && data.exam_jm != '' && data.exam_jm.enumber != '') {

                    var dataArr = {
                        id: data.id, //企业id
                        type: 4,
                        check_id: data.check_id,
                        exam: data.exam_jm.enumber,
                        cid: data.exam_jm.exam_id,
                        sourceurl: window.location.pathname,
                        sourcetitle: document.title,
                        quarter_name: data.quarter,
                    };
                    openMockExam(dataArr)
                } else {
                    ShowToast('技能模拟暂无试卷');
                }
            } else {//实操
                if (data.exam_scm != null && data.exam_scm != '' && data.exam_scm.enumber != '') {
                    var dataArr = {
                        id: data.id, //企业id
                        type: 5,
                        check_id: data.check_id,
                        exam: data.exam_scm.enumber,
                        cid: data.exam_scm.exam_id,
                        sourceurl: window.location.pathname,
                        sourcetitle: document.title,
                        quarter_name: data.quarter,
                    };
                    openMockExam(dataArr)
                } else {
                    ShowToast('实操模拟暂无试卷');
                }
            }

        }
        dialogBox.close({
            dialogName: 'share'
        });
    });
}

function ReturnMockType(data) {

    //	if (data.hasOwnProperty("chengji")) {
    //
    //		if (data.chengji.constructor != Object) {//老师批卷
    //			if (data.chengji > data.efen && data.chengji != null) {//成绩通过,老师批卷
    //				return 1;
    //			} else {
    //				return 0;
    //			}
    //		} else if (data.chengji.constructor == Object) {//老师未批卷
    //			if (data.chengji.chengji > data.efen && data.chengji != null) {//成绩通过,老师未批卷
    //				return 1;
    //			} else {
    //				return 0;
    //			}
    //		}
    //	} else {
    return 0;
    //	}
}

//打开模拟考试页
function openMockExam(data) {
    if (data.type == 5) {//实操
        api.openWin({useWKWebView:true,
            name: 'FieldTestFrame',
            url: 'FieldTestFrame.html',
            pageParam: data,
            bounces: false,
            vScrollBarEnabled: true,
            hScrollBarEnabled: false,
            slidBackEnabled: false,
            softInputMode: 'pan',
        });
        return;
    } else {
        api.openWin({useWKWebView:true,
            name: 'MockExamFrame',
            url: 'MockExamFrame.html',
            pageParam: data,
            bounces: false,
            vScrollBarEnabled: true,
            hScrollBarEnabled: false,
            slidBackEnabled: false,
            softInputMode: 'pan',
        });
    }
}

//打开模拟考试结果页
function openMockExamScore(data) {
    api.openWin({useWKWebView:true,
        name: 'MockExamScoreFrame',
        url: 'MockExamScoreFrame.html',
        pageParam: data,
        bounces: false,
        vScrollBarEnabled: true,
        hScrollBarEnabled: false,
        slidBackEnabled: false,
        softInputMode: 'pan',
    });
}
